home *** CD-ROM | disk | FTP | other *** search
/ PC Media 7 / PC MEDIA CD07.iso / share / prog / cm / cmtbdict.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-06  |  1.8 KB  |  43 lines

  1. // CmTBDict.h
  2. // -----------------------------------------------------------------
  3. // Compendium - C++ Container Class Library
  4. // Copyright (C) 1992-1994, Glenn M. Poorman, All rights reserved
  5. // -----------------------------------------------------------------
  6. // BTree dictionary template definition.
  7. // -----------------------------------------------------------------
  8.  
  9. #ifndef _CMTBDICT_H
  10. #define _CMTBDICT_H
  11.  
  12. #include <cm/include/cmtbtree.h>
  13. #include <cm/include/cmtassoc.h>
  14.  
  15. template <class T, class O>
  16. class CmTBTreeDictionary : public CmTBTree< CmTAssociation<T, O> > {
  17. public:
  18.   CmTBTreeDictionary(unsigned = 10);                // Default constructor.
  19.   CmTBTreeDictionary(const CmTBTreeDictionary<T,O>&); // Copy constructor.
  20.  ~CmTBTreeDictionary() {}                           // Destructor.
  21.  
  22.                                                     // Assignment.
  23.   CmTBTreeDictionary<T,O>& operator=(const CmTBTreeDictionary<T,O>&);
  24.  
  25.   Bool     addKey          (const T&);              // Add key.
  26.   Bool     addKeyAndObject (const T&, const O&);    // Add assoc.
  27.   Bool     addAssoc        (const CmTAssociation<T,O>&); // Add assoc.
  28.   Bool     removeKey       (const T&);              // Remove assoc with key.
  29.   const T& lookupKey       (const T&) const;        // Return equal key.
  30.   const O& lookupObject    (const T&) const;        // Return object by key.
  31.   Bool     replace         (const T&, const O&);    // Rep obj at key.
  32.   Bool     containsKey     (const T&) const;        // See if key in dict.
  33.   unsigned occurrencesOfKey(const T&) const;        // How many equal keys.
  34.  
  35.   const CmTAssociation<T,O>& lookupAssoc(const T&) const;  // Lookup assoc.
  36. };
  37.  
  38. #if defined(__TURBOC__) || defined(__xlC__)
  39. #include <cm/include/cmtbdict.cc>
  40. #endif
  41.  
  42. #endif
  43.